﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SIA.Configurators;

namespace SIA.HwAccess
{
    public interface IRawData : IDictionary<String, Byte[]>
    {

    }

    public interface IHwResource
    {
        String Name { get; }
        String Group { get; set; }
        String Comment { get; set; }

        IDictionaryProperty DictionaryProperty { get; }
    }

    public enum eDeviceStatus { UNDEF, OK, FAULT }
    public interface IHwDevice : IHwResource
    {
        IHwConnections Connections { get; }
        eDeviceStatus Status { get; }
    }
    /// <summary>Stato della Connessione</summary>
    public delegate void ConnectionStatus(IHwConnection conn, eConnectionStatus lastStatus);
    public delegate void ConnectionEvent(IHwConnection conn);
    public delegate void ConnectionDataEvent(IHwConnection conn, IRawData data);
    public enum eConnectionStatus { UNDEF, CONNECT, DISCONNECT, ERROR }
    public interface IHwConnection : IHwResource
    {
        IRawData RawData { get; }

        IHwSignalsGroup SignalsGroup { get; }
        IHwSignals Signals { get; }
        eConnectionStatus Status { get; }

        event ConnectionStatus StatusChange;
        event ConnectionDataEvent DataArrived;

        void requestWriteData(IHwAddress address, int offset, Byte value);
        void connect();
        void disconnect();
        void register(IHwSignal signal);
    }

    public interface IHwSignalsGroup : IHwResource
    {
        IHwSignals Signals { get; }
        IHwSignal this[String key] { get; }

        void Add(IHwSignal signal);
        void Merge(IHwSignals signals);
    }

    
}

